

function newElement() {
    var date= new Date();
    var li = document.createElement("li");
    var inputValue = document.getElementById("myInput").value;
    var t = document.createTextNode(inputValue);
    if (inputValue === ''){
        alert("你必须做点东西！");
    }else {
        document.getElementById("myUL").appendChild(li);
    }
    document.getElementById("myInput").value = "";
    var div = document.createElement("div");
    li.appendChild(div);
    div.innerText = inputValue;
    var p =document.createElement("p");
    li.appendChild(p);
    p.className = "pp";
    var span = document.createElement("span");
    var txt = document.createTextNode("\u00D7");
    var time = document.createTextNode(date);
    p.appendChild(time);
    span.className = "close";
    div.className = "dd";
    span.appendChild(txt);
    li.appendChild(span);
    span.onclick = function () {
        var div = this.parentElement;
        list.removeChild(this.parentNode);

    }
    for(var n = 0;n<1000;n++){
        document.querySelectorAll('#myUL li div')[n].setAttribute("contenteditable", "true");
    }

}

var list = document.querySelector('.lop');
list.addEventListener('click',function (ev) {
    if (ev.target.tagName === 'LI'){
        ev.target.classList.toggle('checked');
    }
},false);


document.onkeydown = function (e) { // 回车提交表单
// 兼容FF和IE和Opera
    var theEvent = window.event || e;
    var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
    if (code == 13) {
        newElement();
    }
}
function queryInfo() {
    newElement
}